image-meta
Detect image type and size using pure javascript.
Usage
Install package:
npm install image-meta
yarn add image-meta
pnpm install image-meta
bun install image-meta
import { imageMeta } from "image-meta";
const data = await fetch(url).then((res) => res.buffer());
const meta = imageMeta(data);
Note: imageMeta
throws an error if either data is not a Buffer
/Uint8Array
, or data is invalid or type cannot be determined. You should wrap it into a try/catch
statement to handle errors.
Development
- Clone this repository
- Install latest LTS version of Node.js
- Enable Corepack using
corepack enable
- Install dependencies using
pnpm install
- Run interactive tests using
pnpm dev
License
Made with 💛
Published under MIT License.